package com.lime49.lockcrypt.idletimer;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;

public interface Xss extends Library {

    /** Xss Instance */
    Xss INSTANCE = (Xss) Native.loadLibrary("Xss", Xss.class);

    /**
     * XScreenSaverInfo struct
     */
    public static class XScreenSaverInfo extends Structure {
        public X11.Window window; /* screen saver window - may not exist */
        public int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverDisabled */
        public int kind; /* ScreenSaverBlanked, ...Internal, ...External */
        public NativeLong til_or_since; /* time til or since screen saver */
        public NativeLong idle; /* total time since last user input */
        public NativeLong eventMask; /* currently selected events for this client */
    }

    /**
     * Information sur l'activation de l'ecran de veille de X11.
     * 
     * @param display display
     * @param event_base event_base
     * @param error_base error_base
     * 
     * @return true if XScreenSaver extension is loaded
     * 
     * @see com.sun.jna.ptr.IntByReference
     */
    public boolean XScreenSaverQueryExtension(X11.Display display,
            IntByReference event_base, IntByReference error_base);

    /**
     * XScreenSaverAllocInfo.
     * 
     * @return XScreenSaverInfo instance
     */
    public XScreenSaverInfo XScreenSaverAllocInfo();

    /**
     * XScreenSaverQueryInfo.
     * 
     * @param display
     * @param drawable
     * @param infos
     * @return status flag
     */
    public int XScreenSaverQueryInfo(X11.Display display,
            X11.Drawable drawable, XScreenSaverInfo infos);
}
